.class public Lcom/brixd/niceapp/control/RhythmAdapter;
.super Landroid/widget/BaseAdapter;
.source "RhythmAdapter.java"


# instance fields
.field private R:Lcom/zuiapps/suite/utils/ui/ResUtil;

.field private inflater:Landroid/view/LayoutInflater;

.field private itemWidth:F

.field private mActivity:Landroid/app/Activity;

.field private mAppModels:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/brixd/niceapp/model/AppModel;",
            ">;"
        }
    .end annotation
.end field

.field private mImageLoader:Lcom/nostra13/universalimageloader/core/ImageLoader;

.field private mRhythmLayout:Lcom/brixd/niceapp/control/RhythmLayout;

.field private options:Lcom/nostra13/universalimageloader/core/DisplayImageOptions;


# direct methods
.method public constructor <init>(Landroid/app/Activity;Lcom/brixd/niceapp/control/RhythmLayout;Ljava/util/List;)V
    .registers 6
    .param p1, "activity"    # Landroid/app/Activity;
    .param p2, "rhythmLayout"    # Lcom/brixd/niceapp/control/RhythmLayout;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/app/Activity;",
            "Lcom/brixd/niceapp/control/RhythmLayout;",
            "Ljava/util/List",
            "<",
            "Lcom/brixd/niceapp/model/AppModel;",
            ">;)V"
        }
    .end annotation

    .prologue
    .local p3, "appModels":Ljava/util/List;, "Ljava/util/List<Lcom/brixd/niceapp/model/AppModel;>;"
    const/4 v1, 0x1

    .line 36
    invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V

    .line 37
    iput-object p1, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mActivity:Landroid/app/Activity;

    .line 38
    iput-object p2, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mRhythmLayout:Lcom/brixd/niceapp/control/RhythmLayout;

    .line 39
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mAppModels:Ljava/util/List;

    .line 40
    iget-object v0, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mAppModels:Ljava/util/List;

    invoke-interface {v0, p3}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z

    .line 41
    if-eqz p1, :cond_1c

    .line 42
    invoke-static {p1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v0

    iput-object v0, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->inflater:Landroid/view/LayoutInflater;

    .line 44
    :cond_1c
    invoke-static {p1}, Lcom/zuiapps/suite/utils/ui/ResUtil;->getInstance(Landroid/content/Context;)Lcom/zuiapps/suite/utils/ui/ResUtil;

    move-result-object v0

    iput-object v0, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    .line 45
    new-instance v0, Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;

    invoke-direct {v0}, Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;-><init>()V

    invoke-virtual {v0, v1}, Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;->resetViewBeforeLoading(Z)Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;

    move-result-object v0

    invoke-virtual {v0, v1}, Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;->cacheInMemory(Z)Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;

    move-result-object v0

    invoke-virtual {v0, v1}, Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;->cacheOnDisc(Z)Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;

    move-result-object v0

    sget-object v1, Lcom/nostra13/universalimageloader/core/assist/ImageScaleType;->EXACTLY:Lcom/nostra13/universalimageloader/core/assist/ImageScaleType;

    invoke-virtual {v0, v1}, Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;->imageScaleType(Lcom/nostra13/universalimageloader/core/assist/ImageScaleType;)Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;

    move-result-object v0

    sget-object v1, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;

    .line 46
    invoke-virtual {v0, v1}, Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;->bitmapConfig(Landroid/graphics/Bitmap$Config;)Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;

    move-result-object v0

    new-instance v1, Lcom/nostra13/universalimageloader/core/display/SimpleBitmapDisplayer;

    invoke-direct {v1}, Lcom/nostra13/universalimageloader/core/display/SimpleBitmapDisplayer;-><init>()V

    invoke-virtual {v0, v1}, Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;->displayer(Lcom/nostra13/universalimageloader/core/display/BitmapDisplayer;)Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;

    move-result-object v0

    invoke-virtual {v0}, Lcom/nostra13/universalimageloader/core/DisplayImageOptions$Builder;->build()Lcom/nostra13/universalimageloader/core/DisplayImageOptions;

    move-result-object v0

    iput-object v0, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->options:Lcom/nostra13/universalimageloader/core/DisplayImageOptions;

    .line 47
    invoke-static {}, Lcom/nostra13/universalimageloader/core/ImageLoader;->getInstance()Lcom/nostra13/universalimageloader/core/ImageLoader;

    move-result-object v0

    iput-object v0, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mImageLoader:Lcom/nostra13/universalimageloader/core/ImageLoader;

    .line 48
    return-void
.end method


# virtual methods
.method public getAppModels()Ljava/util/List;
    .registers 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Lcom/brixd/niceapp/model/AppModel;",
            ">;"
        }
    .end annotation

    .prologue
    .line 55
    iget-object v0, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mAppModels:Ljava/util/List;

    return-object v0
.end method

.method public getCount()I
    .registers 2

    .prologue
    .line 60
    iget-object v0, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mAppModels:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    return v0
.end method

.method public getItem(I)Ljava/lang/Object;
    .registers 3
    .param p1, "position"    # I

    .prologue
    .line 65
    iget-object v0, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mAppModels:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method

.method public getItemId(I)J
    .registers 4
    .param p1, "position"    # I

    .prologue
    .line 70
    iget-object v0, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mAppModels:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/model/AppModel;

    invoke-virtual {v0}, Lcom/brixd/niceapp/model/AppModel;->getId()I

    move-result v0

    int-to-long v0, v0

    return-wide v0
.end method

.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .registers 18
    .param p1, "position"    # I
    .param p2, "convertView"    # Landroid/view/View;
    .param p3, "parent"    # Landroid/view/ViewGroup;

    .prologue
    .line 79
    iget-object v10, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mAppModels:Ljava/util/List;

    invoke-interface {v10, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/model/AppModel;

    .line 81
    .local v0, "appModel":Lcom/brixd/niceapp/model/AppModel;
    iget-object v10, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->inflater:Landroid/view/LayoutInflater;

    iget-object v11, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    const-string v12, "adapter_rhythm_icon"

    invoke-virtual {v11, v12}, Lcom/zuiapps/suite/utils/ui/ResUtil;->layoutId(Ljava/lang/String;)I

    move-result v11

    const/4 v12, 0x0

    invoke-virtual {v10, v11, v12}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v6

    check-cast v6, Landroid/widget/RelativeLayout;

    .line 82
    .local v6, "viewGroup":Landroid/widget/RelativeLayout;
    new-instance v9, Landroid/widget/RelativeLayout$LayoutParams;

    iget v10, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->itemWidth:F

    float-to-int v10, v10

    iget-object v11, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mActivity:Landroid/app/Activity;

    invoke-virtual {v11}, Landroid/app/Activity;->getResources()Landroid/content/res/Resources;

    move-result-object v11

    iget-object v12, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    const-string v13, "rhythm_item_height"

    .line 83
    invoke-virtual {v12, v13}, Lcom/zuiapps/suite/utils/ui/ResUtil;->dimenId(Ljava/lang/String;)I

    move-result v12

    .line 82
    invoke-virtual {v11, v12}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

    move-result v11

    invoke-direct {v9, v10, v11}, Landroid/widget/RelativeLayout$LayoutParams;-><init>(II)V

    .line 84
    .local v9, "viewGroupLayoutParams":Landroid/widget/RelativeLayout$LayoutParams;
    invoke-virtual {v6, v9}, Landroid/widget/RelativeLayout;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 85
    iget v10, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->itemWidth:F

    invoke-virtual {v6, v10}, Landroid/widget/RelativeLayout;->setTranslationY(F)V

    .line 87
    const/4 v10, 0x0

    invoke-virtual {v6, v10}, Landroid/widget/RelativeLayout;->getChildAt(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/RelativeLayout;

    .line 88
    .local v7, "viewGroupInner":Landroid/widget/RelativeLayout;
    iget v10, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->itemWidth:F

    float-to-int v10, v10

    iget-object v11, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mActivity:Landroid/app/Activity;

    invoke-virtual {v11}, Landroid/app/Activity;->getResources()Landroid/content/res/Resources;

    move-result-object v11

    iget-object v12, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    const-string v13, "rhythm_icon_margin"

    invoke-virtual {v12, v13}, Lcom/zuiapps/suite/utils/ui/ResUtil;->dimenId(Ljava/lang/String;)I

    move-result v12

    invoke-virtual {v11, v12}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

    move-result v11

    mul-int/lit8 v11, v11, 0x2

    sub-int v5, v10, v11

    .line 89
    .local v5, "innerItemWidth":I
    iget-object v10, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mActivity:Landroid/app/Activity;

    invoke-virtual {v10}, Landroid/app/Activity;->getResources()Landroid/content/res/Resources;

    move-result-object v10

    iget-object v11, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    const-string v12, "rhythm_item_height"

    invoke-virtual {v11, v12}, Lcom/zuiapps/suite/utils/ui/ResUtil;->dimenId(Ljava/lang/String;)I

    move-result v11

    invoke-virtual {v10, v11}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

    move-result v10

    iget-object v11, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mActivity:Landroid/app/Activity;

    .line 90
    invoke-virtual {v11}, Landroid/app/Activity;->getResources()Landroid/content/res/Resources;

    move-result-object v11

    iget-object v12, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    const-string v13, "rhythm_icon_margin"

    invoke-virtual {v12, v13}, Lcom/zuiapps/suite/utils/ui/ResUtil;->dimenId(Ljava/lang/String;)I

    move-result v12

    invoke-virtual {v11, v12}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

    move-result v11

    mul-int/lit8 v11, v11, 0x2

    sub-int v4, v10, v11

    .line 91
    .local v4, "innerItemHeight":I
    new-instance v8, Landroid/widget/RelativeLayout$LayoutParams;

    invoke-direct {v8, v5, v4}, Landroid/widget/RelativeLayout$LayoutParams;-><init>(II)V

    .line 92
    .local v8, "viewGroupInnerLayoutParams":Landroid/widget/RelativeLayout$LayoutParams;
    invoke-virtual {v7, v8}, Landroid/widget/RelativeLayout;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 94
    iget-object v10, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    const-string v11, "image_icon"

    invoke-virtual {v10, v11}, Lcom/zuiapps/suite/utils/ui/ResUtil;->viewId(Ljava/lang/String;)I

    move-result v10

    invoke-virtual {v6, v10}, Landroid/widget/RelativeLayout;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/ImageView;

    .line 95
    .local v2, "imageIcon":Landroid/widget/ImageView;
    iget-object v10, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mActivity:Landroid/app/Activity;

    invoke-virtual {v10}, Landroid/app/Activity;->getResources()Landroid/content/res/Resources;

    move-result-object v10

    iget-object v11, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->R:Lcom/zuiapps/suite/utils/ui/ResUtil;

    const-string v12, "rhythm_icon_margin"

    invoke-virtual {v11, v12}, Lcom/zuiapps/suite/utils/ui/ResUtil;->dimenId(Ljava/lang/String;)I

    move-result v11

    invoke-virtual {v10, v11}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

    move-result v10

    mul-int/lit8 v10, v10, 0x2

    sub-int v1, v5, v10

    .line 96
    .local v1, "imageEdgeSize":I
    invoke-virtual {v2}, Landroid/widget/ImageView;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v3

    .line 97
    .local v3, "imageIconLayoutParam":Landroid/view/ViewGroup$LayoutParams;
    iput v1, v3, Landroid/view/ViewGroup$LayoutParams;->width:I

    .line 98
    iput v1, v3, Landroid/view/ViewGroup$LayoutParams;->height:I

    .line 99
    invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 101
    iget-object v10, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mImageLoader:Lcom/nostra13/universalimageloader/core/ImageLoader;

    invoke-virtual {v0}, Lcom/brixd/niceapp/model/AppModel;->getIconUrl()Ljava/lang/String;

    move-result-object v11

    iget-object v12, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->options:Lcom/nostra13/universalimageloader/core/DisplayImageOptions;

    invoke-virtual {v10, v11, v2, v12}, Lcom/nostra13/universalimageloader/core/ImageLoader;->displayImage(Ljava/lang/String;Landroid/widget/ImageView;Lcom/nostra13/universalimageloader/core/DisplayImageOptions;)V

    .line 103
    return-object v6
.end method

.method public notifyDataSetChanged()V
    .registers 2

    .prologue
    .line 108
    invoke-super {p0}, Landroid/widget/BaseAdapter;->notifyDataSetChanged()V

    .line 109
    iget-object v0, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mRhythmLayout:Lcom/brixd/niceapp/control/RhythmLayout;

    invoke-virtual {v0}, Lcom/brixd/niceapp/control/RhythmLayout;->invalidateData()V

    .line 110
    return-void
.end method

.method public setAppModels(Ljava/util/List;)V
    .registers 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Lcom/brixd/niceapp/model/AppModel;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 51
    .local p1, "mAppModels":Ljava/util/List;, "Ljava/util/List<Lcom/brixd/niceapp/model/AppModel;>;"
    iput-object p1, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->mAppModels:Ljava/util/List;

    .line 52
    return-void
.end method

.method public setItemWidth(F)V
    .registers 2
    .param p1, "itemWidth"    # F

    .prologue
    .line 74
    iput p1, p0, Lcom/brixd/niceapp/control/RhythmAdapter;->itemWidth:F

    .line 75
    return-void
.end method
